/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package persistencia.conexao

import groovy.sql.Sql;
import org.postgresql.jdbc2.optional.PoolingDataSource;
import persistencia.conexao.IConexao;

/**
 *
 * @author André
 */
class Conexao implements IConexao{

    def sql = null;

    def Sql getConexao(){
        if(sql == null){
//            def dataSource = new PoolingDataSource();
//            dataSource.setDatabaseName("tcc");
//            dataSource.setPassword("tcc");
//            dataSource.setUser("tcc");
//            dataSource.setPortNumber(5432);
//            dataSource.setServerName("localhost");
            sql = Sql.newInstance("jdbc:postgresql://localhost:5432/tcc", "tcc",
                      "tcc", "org.postgresql.Driver");
            //sql = new groovy.sql.Sql(dataSource)            
        }
        return sql
    }
}

